import request from '@/utils/request'

// 商品列表
export function getGoodsLists(query) {
    return request({
        url: '/joining/busin.Goods/getLists',
        method: 'post',
        params: query
    })
}

// 商品分类列表
export function getGoodsCateLists(query) {
    return request({
        url: '/joining/busin.Goods/getCateLists',
        method: 'post',
        params: query
    })
}

// 商品详情
export function getGoodsInfo(query) {
    return request({
        url: '/joining/busin.Goods/getInfo',
        method: 'post',
        params: query
    })
}

// 添加、编辑商品
export function setGoodsInfo(data) {
    const formData = new URLSearchParams();
    for (const key in data) {
        if (data.hasOwnProperty(key)) {
            formData.append(key, data[key]);
        }
    }
    return request({
        url: '/joining/busin.Goods/setInfo',
        method: 'post',
        data: formData,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'
        }
    })
}

// 禁用、启用商品
export function setGoodsStatus(query) {
    return request({
        url: '/joining/busin.Goods/setStatus',
        method: 'post',
        params: query
    })
}

// 商品排序
export function setGoodsSort(query) {
    return request({
        url: '/joining/busin.Goods/setSort',
        method: 'post',
        params: query
    })
}

// 删除商品
export function delGoodsInfo(query) {
    return request({
        url: '/joining/busin.Goods/delInfo',
        method: 'post',
        params: query
    })
}

// 商品审核
export function putGoodsInfo(query) {
    return request({
        url: '/joining/busin.Goods/putInfo',
        method: 'post',
        params: query
    })
}

// 商品_入库_入库信息详情
export function getHousingInfo(query) {
    return request({
        url: '/joining/busin.Goods/getHousing',
        method: 'post',
        params: query
    })
}

// 商品_入库_操作入库
export function setHousing(data) {
    const formData = new URLSearchParams();
    for (const key in data) {
        if (data.hasOwnProperty(key)) {
            formData.append(key, data[key]);
        }
    }
    return request({
        url: '/joining/busin.Goods/setHousing',
        method: 'post',
        data: formData,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'
        }
    })
}

//商品_全部负责员工列表(不分页)
export function getRespStaffLists(query) {
    return request({
        url: '/joining/busin.Goods/getRespStaffLists',
        method: 'post',
        params: query
    })
}

//分配商品负责员工
export function setrespStaff(query) {
    return request({
        url: '/joining/busin.Goods/respStaff',
        method: 'post',
        params: query
    })
}


// 聊天_聊天好友列表
export function getHuanxinUsers(query) {
    return request({
        url: '/joining/busin.Staff/getHuanxinUsers',
        method: 'post',
        params: query
    })
}

// PC_商品_设置/取消首页推荐
export function setGoodsHome(query) {
    return request({
        url: '/joining/busin.Goods/setHome',
        method: 'post',
        params: query
    })
}